package com.kelvin.oocl.crm.util;

public class MySimpleMap<R,S> {
	private Entry<R, S>[] table;
	private int currIndex = 0;
	
	@SuppressWarnings("unchecked")
	public MySimpleMap() {
		table = (Entry<R, S>[]) new Entry<?, ?>[10];
	}
	
	public void put(R key,S value){
		table[currIndex++] = new Entry<R, S>(key, value);
	}
	
	public S getKey(R key){
		for(int i=0;i<table.length;i++){
			if(key.equals(table[i].key)){
				return table[i].value;
			}
		}
		return null;
	}
	
	static class Entry<K,V> {
		K key;
		V value;
		Entry<K,V> nextEntry;
		
		public Entry() {
		}
		
		public Entry(K key,V value) {
			this.key = key;
			this.value = value;
		}
		
	}
}
